package com.zat.mes.andrmes.dofun.qualitytest.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.customerview.DrawLineTextView
import com.zat.mes.andrmes.customerview.DrawLineTextView.GRAVITY_ALL
import com.zat.mes.andrmes.customerview.DrawLineTextView.GRAVITY_TOP_LEFT_BOTTOM
import com.zat.mes.andrmes.data.KvBean

/**
 * @author zy
 * @date :2020-02-22 09:28
 * @description:质检处理activity
 */
class OnSiteDetailAdapter(layoutResId: Int) :
    BaseQuickAdapter<KvBean, BaseViewHolder>(layoutResId) {

    override fun convert(helper: BaseViewHolder, item: KvBean) {
        if (helper.layoutPosition == 0) {
            //第一个top lef bottom 都要line
            val dwTextTitle = helper.getView<DrawLineTextView>(R.id.dwTextTitel)
            dwTextTitle.setLineGravity(GRAVITY_TOP_LEFT_BOTTOM)
            val dwTextDetail = helper.getView<DrawLineTextView>(R.id.dwTextDetail)
            dwTextDetail.setLineGravity(GRAVITY_ALL)
        }

        helper.setText(R.id.dwTextTitel, item?.key)
        helper.setText(R.id.dwTextDetail, item?.value)
    }
}